package com.tom.AIAnswer.config;

import com.zhipu.oapi.ClientV4;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * AI配置类，用来创建clientV4对象
 * 把apiKey写入配置文件，封装client客户端
 */
@Configuration
@ConfigurationProperties(prefix = "ai")
@Data
public class AIConfig {

    private String apikey;


    @Bean
    public ClientV4 client(){
        return new ClientV4.Builder(apikey).build();
    }

}
